//package com.ruoyi.ahs.scheduler;
//
//import com.ruoyi.ahs.cache.AhsCache;
//import com.ruoyi.ahs.util.RushTaskDto;
//import com.ruoyi.system.domain.RushConfig;
//import com.ruoyi.system.domain.RushTask;
//import com.ruoyi.system.service.IRushConfigService;
//import com.ruoyi.system.service.impl.RushTaskServiceImpl;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.PostConstruct;
//import javax.annotation.Resource;
//import java.util.ArrayList;
//import java.util.List;
//
///**
// * TODO to describe CacheInitializer
// *
// * @author 辛凤文
// * @since 1.0
// */
//@Slf4j
//@Component("ahsCacheInitializer")
//public class AhsCacheInitializer {
//
//    @Resource
//    private RushTaskServiceImpl rushTaskServiceImpl;
//
//    @Resource
//    private IRushConfigService rushConfigService;
//
//    @PostConstruct
//    public void init() {
//        log.info("初始化配置。。。。。。");
//        flush();
//        log.info("初始化配置完成！");
//    }
//
//    public void flush() {
//        log.info("刷新配置中");
//        RushConfig rushConfig = rushConfigService.selectRushConfigById(1L);
//        AhsCache.setCurrentConfig(rushConfig);
//        //任务列表
//        RushTask rt = new RushTask();
//        rt.setStatus("0");
//        List<RushTask> rushTasks = rushTaskServiceImpl.selectRushTaskList(rt);
//        ArrayList<RushTaskDto> rushTaskDtos = new ArrayList<>();
//        for (RushTask rushTask : rushTasks) {
//            RushTaskDto rushTaskDto = new RushTaskDto(rushTask);
//            rushTaskDtos.add(rushTaskDto);
//        }
//        AhsCache.setRushTaskCache(rushTaskDtos);
//        log.info("已刷新");
//    }
//}
